package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.ReportService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 数据统计控制器
 * @author GY
 * @version V1.0
 * @date 2025-01-15 11:24
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class ReportController {
    private final ReportService reportService;

    /**
     * 5.1员工性别统计
     */
    @GetMapping("/report/empGenderData")
    public Result empFindByGender(){
        log.info("ReportController empFindByGender");
        List<Map<String, Object>> data = reportService.empFindByGender();
        return Result.success(data);
    }

    /**
     * 5.2 员工职位人数统计
     */
    @GetMapping("/report/empJobData")
    public Result empFindByJob(){
        log.info("ReportController empFindByJob");
        JobOption jobOption = reportService.empFindByJob();
        return Result.success(jobOption);
    }

    /**
     * 5.3学员学历统计
     */
    @GetMapping("/report/studentDegreeData")
    public Result studentFindByDegree(){
        log.info("ReportController studentFindByDegree");
        List<Map<String, Object>> data  = reportService.studentFindByDegree();
        return Result.success(data);
    }

    /**
     * 5.4班级人数统计
     */
    @GetMapping("/report/studentCountData")
    public Result studentFondByClazz(){
        log.info("ReportController studentFondByClazz");
        StudentOption studentOption =reportService.studentFondByClazz();
        return Result.success(studentOption);
    }
}
